import 'package:flutter/material.dart';

class ModalBottomSheetApp extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: '模态底部面板',
      theme: new ThemeData(
        primaryColor: Colors.blue
      ),
      home: new ModalSheetHomePage(),
    );
  }
}

class ModalSheetHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(title: new Text("底部面板")),
      body: new Center(
        child: new RaisedButton(
          child: new Text("弹出底部面板"),
          onPressed: () {
            showModalBottomSheet(context: context, builder: (BuildContext context){
              return new Container(
                padding: const EdgeInsets.fromLTRB(12.0, 16.0, 12.0, 16.0),
                child: new Text("这是模态底部面板，点击任意位置即可关闭", textAlign: TextAlign.left)
              );
            });
          },
        ),
      ),
    );
  }
}